/**
 * 客户投诉接待
 *
 * @Author: 刘国强
 * @Date: 2019/8/7
 */
import axios from '@/api/fetch';
import * as types from './types';
import SERVER from '@/api/server';

// 查询投诉接待分页信息
export const queryComplaint = params => axios.get(`${SERVER.DMSCLOUD_CUSTOMERREPAIR}/customer/complaintQuery`, { params });

// 查询车型
export const getModelList = params => axios.get(`${SERVER.DMSCLOUD_CUSTOMERREPAIR}/customer/complaintReception/getModelList`);

// 新增/保存客户投诉
export const addComplaint = params => axios.post(`${SERVER.DMSCLOUD_CUSTOMERREPAIR}/customer/complaintReception/btnSave`, params, { mark: types.SAVE });

// 新增/保存客户投诉
export const saveComplaint = params => axios.post(`${SERVER.DMSCLOUD_CUSTOMERREPAIR}/customer/complaintReception/saveComplaint`, params, { mark: types.SAVE });

// 投诉上报ACC
export const sendAccComplaint = params => axios.post(`${SERVER.DMSCLOUD_CUSTOMERREPAIR}/customer/complaintReception/btnSendAcc`, params, { mark: types.SAVE });

// 投诉受理ACC
export const sendAccAcceptance = params => axios.post(`${SERVER.DMSCLOUD_CUSTOMERREPAIR}/customer/complaintReception/btnEptanceAcc`, params, { mark: types.SAVE });

// 根据Id查询投诉详情
export const getCompalaintById = complaintId => axios.get(`${SERVER.DMSCLOUD_CUSTOMERREPAIR}/customer/complaintReception/getCompalaintByNo/${complaintId}`);

// 根据ID删除跟进明细
export const delComplaintDetailById = Id => axios.delete(`${SERVER.DMSCLOUD_CUSTOMERREPAIR}/customer/complaintReception/delComplaintDetailById/${Id}`);

// 根据ID结案
export const closeComplaintById = Id => axios.post(`${SERVER.DMSCLOUD_CUSTOMERREPAIR}/customer/complaintReception/closeComplaintById/${Id}`);

// 查询被投诉部门
export const searchDealerOrg = params => axios.get(`${SERVER.DMSCLOUD_BASEDATA}/org/getAllSmallOrg`);

// 查询所有员工
export const getDealerUser = params => axios.get(`${SERVER.DMSCLOUD_BASEDATA}/basedata/users/getDealerUser`);

// 查询工单选择框
export const searchRepairOrder = params => axios.get(`${SERVER.DMSCLOUD_REPAIR}/order/repair/searchCustomerSelect`, { params });

// 查询车辆选择框
export const searchVehicle = params => axios.get(`${SERVER.DMSCLOUD_REPAIR}/order/repair/searchVehicleSelect`, { params });

// 根据投诉编号删除投诉信息
export const delComplaintById = complaintId => axios.delete(`${SERVER.DMSCLOUD_CUSTOMERREPAIR}/customer/complaintQuery/${complaintId}`);

// 根据投诉单ID进行受理操作
export const acceptComplaintById = complaintId => axios.post(`${SERVER.DMSCLOUD_CUSTOMERREPAIR}/customer/complaintReception/acceptComplaint/${complaintId}`);

// 导出客户投诉处理情况
export const exportComplaint = params => axios.get(`${SERVER.DMSCLOUD_CUSTOMERREPAIR}/customer/complaintQuery/export`, { params, responseType: 'arraybuffer' });

// 查询FD单号
export const getFdOrder = params => axios.get(`${SERVER.DMSCLOUD_REPAIR}/order/repair/getFdOrderForComplaint`, { params });

// 回访信息
export const saveComlaintReturnVisit = params => axios.post(`${SERVER.DMSCLOUD_CUSTOMERREPAIR}/customer/complaintReception/saveComlaintReturnVisit`, params, { mark: types.SAVE });
